<?php

class User_model extends MY_Model
{
    private $db;
    private $data_db;

    public function __construct()
    {
        parent::__construct();
        $this->db = $this->load->database('account_db', true);
        $this->data_db = $this->load->database('data_db', true);
    }

    public function get_account_info($account = null, $ip = null, $id_card = null)
    {
        if ($account) {
            if (is_array($account)) {
                $this->db->where_in('sAccount', $account);
            } else {
                $this->db->where('sAccount', $account);
            }
        }
        if ($ip) {
            if (is_array($ip)) {
                $this->db->where_in('sLoginIP', $ip);
            } else {
                $this->db->where('sLoginIP', $ip);
            }

        }
        if ($id_card) {
            if (is_array($id_card)) {
                $this->db->where_in('sSSNo', $id_card);
            } else {
                $this->db->where('sSSNo', $id_card);
            }
        }
        $query = $this->db->get('Account');
        return $query->result_array();
    }

    public function get_user_info($name = null, $status = 0, $account = null)
    {
        if ($status > 0){
            $this->db->where('boDelete', $status);
        }
        if ($account) {
            if (is_array($account)) {
                $this->db->where_in('sAccount', $account);
            } else {
                $this->db->where('sAccount', $account);
            }
        }
        if ($name) {
            if (is_array($name)) {
                $this->db->where_in('sName', $name);
            } else {
                $this->db->where('sName', $name);
            }
        }
        $query = $this->data_db->get('HumDB');
        return $query->result_array();
    }

    public function get_hero_info()
    {

    }
}